import time

f = open("m1_sorted.txt")
sp = (list(map(int, f.readlines())))
start = time.time()
while True:
    fl = 1
    for i in range(len(sp) - 1):
        if sp[i] > sp[i + 1]:
            sp[i], sp[i + 1] = sp[i + 1], sp[i]
            fl = 0
    if fl == 1:
        break
end = time.time()
print('m1_sorted', round((end - start) * 1000), 'milisecond')
f = open("m2_reverse.txt")
sp = (list(map(int, f.readlines())))
start = time.time()
while True:
    fl = 1
    for i in range(len(sp) - 1):
        if sp[i] > sp[i + 1]:
            sp[i], sp[i + 1] = sp[i + 1], sp[i]
            fl = 0
    if fl == 1:
        break
end = time.time()
print('m2_reverse', round((end - start) * 1000), 'milisecond')
f = open("m3_shuffle.txt")
sp = (list(map(int, f.readlines())))
start = time.time()
while True:
    fl = 1
    for i in range(len(sp) - 1):
        if sp[i] > sp[i + 1]:
            sp[i], sp[i + 1] = sp[i + 1], sp[i]
            fl = 0
    if fl == 1:
        break
end = time.time()
print('m3_shuffle', round((end - start) * 1000), 'milisecond')


